cc.Class({
    extends: cc.Component,

    properties: {
        sprite: cc.Sprite
    },
    start(){
        this.moveSize = this.sprite.spriteFrame.getOriginalSize()
        this.node.setContentSize(this.moveSize.width + this.node.width, this.moveSize.height + this.node.height)
        this.moveAni = cc.tween(this.node).repeatForever(
            cc.tween().by(5,{position : cc.v2(this.moveSize.width,this.moveSize.height)}).call(()=>{
                this.node.position = cc.Vec2.ZERO
            })
        ).start()
    },
    onDestroy(){
        if(this.moveAni){
            this.moveAni.stop()
            this.moveAni = null
        }
    },
});
